package edu.utd.text.game.designer.commands;

import java.util.Scanner;

import edu.utd.text.game.designer.controller.DesignerController;
import edu.utd.text.game.domain.GameMap;

public class DeleteRoomCommand implements DesignerCommand {
	
	public DeleteRoomCommand() {
		
	}
	
	public String execute() {
		Scanner scanner = new Scanner(System.in);
		GameMap map = DesignerController.INSTANCE.getGameMap();
		System.out.println("Name of room to delete: ");
		String roomToDelete = scanner.nextLine();
		if (!map.containsRoomByName(roomToDelete)) {
			return "Room: \"" + roomToDelete + "\" does not exist in the game map.";
		}
		if(!map.removeRoomByName(roomToDelete)) {
			return "Error deleting room " + roomToDelete;
		}
		return "Successfully deleted room: " + roomToDelete;
	}
}
